Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!(action_pack): Use ActiveSupport instead of patches #703

Conversation

xuan-cao-swi
Copy link
Contributor

Description

Use ActiveSupport::Notification to subscribe the log from action controller, then modify the rack span. Remove the patch on function dispatch from metal.rb

Related to #638, #667, issue #218, #635

Test

Added test assertion that focus on error handling.
Tested with rails 6.1.7.1 and 7.1.* that made sure this change has consistent behaviour as original patching.
Tested on basic test suite.


# from rails 6.1, the request will be added to payload
request = payload[:request]
request = payload[:headers].instance_variable_get(:@req) if ::ActionPack.version < Gem::Version.new('6.1.0')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed once the rails 6.0 is no longer supported

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the Rails 6.0 logic and I will merge this PR for you.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Collaborator

@arielvalentin arielvalentin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed during the Ruby SIG on 2023-11-21

Copy link
Contributor

@kaylareopelle kaylareopelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @xuan-cao-swi, nice work! I have some documentation suggestions.

Tests using the example trace_demonstration.ru output essentially identical content before and after the change! 🎉

xuan-cao-swi and others added 4 commits December 5, 2023 12:53
Co-authored-by: Kayla Reopelle (she/her) <[email protected]>
Co-authored-by: Kayla Reopelle (she/her) <[email protected]>
Co-authored-by: Kayla Reopelle (she/her) <[email protected]>
…action_pack/handlers/action_controller.rb

Co-authored-by: Kayla Reopelle (she/her) <[email protected]>
xuan-cao-swi and others added 4 commits December 6, 2023 16:09
…action_pack/handlers/action_controller.rb

Co-authored-by: Kayla Reopelle (she/her) <[email protected]>
…action_pack/handlers/action_controller.rb

Co-authored-by: Kayla Reopelle (she/her) <[email protected]>
…action_pack/handlers/action_controller.rb

Co-authored-by: Kayla Reopelle (she/her) <[email protected]>
…action_pack/handlers.rb

Co-authored-by: Kayla Reopelle (she/her) <[email protected]>
Copy link
Contributor

@kaylareopelle kaylareopelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@arielvalentin arielvalentin merged commit ec81777 into open-telemetry:main Dec 6, 2023
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants